//ts中书写js中的类,演示效果
(()=>{
    //定义一个接口
    interface Iperson{
        firstName:string//姓氏
        lastName:String//名字
    }

    //定义一个类
    class Person{
        //定义公共字段
        firstName:string //姓氏
        lastName:string
        fullName:string

        //定义一个构造器
        constructor (firstName:string,lastName:string){
            //更新属性数据
            this.firstName = firstName;
            this.lastName = lastName;
            // 姓名
            this.fullName = this.firstName+'_'+this.lastName;
        }
    }

    // 定义一个函数
    function showFullName(person:Iperson){
        return person.firstName+'_'+person.lastName;
    }

    // 实例化对象
    const person = new Person('小','卫');

    console.log(showFullName(person));
    
    
})()